﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ShowDependencies.Properties;

namespace ShowDependencies
{
    public partial class ProgressDialog : Form
    {
        private bool isCancelled;

        public ProgressDialog()
        {
            InitializeComponent();
        }

        public bool IsCancelled
        {
            get { return isCancelled; }
        }

        private void ProgressDialog_Load(object sender, EventArgs e)
        {
            SetProperties();
        }
        
        public void SetLabelProgressMessage(string description, int id)
        {
            this.lblProgressMessage.Text = String.Format(Resources.ProgressDialogLabelProgressMessageText, description, id);
            this.lblProgressMessage.Refresh();
        }

        private void SetProperties()
        {
            this.isCancelled = false;
            this.Text = Resources.ProgressDialogText;
            this.Icon = Resources.ShowDependenciesIcon;
            this.Refresh();
            this.ShowIcon = Settings.Default.ProgressDialogShowIcon;
            this.lblInstructions.Text = Resources.ProgressDialogLabelInstructionsText;
            this.lblInstructions.Refresh();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.btnCancel.Enabled = false;
            this.isCancelled = true;
        }
    }
}
